<?php
	// $cs = Yii::app()->getClientScript();
	// $cs->registerScriptFile('/js/rating.js');

	$configStarRaiting  = array(
		'minRating' => '1',
		'maxRating' => '10',
		'starWidth'=>'18',
		'ratingStepSize' => '1',
		'allowEmpty'=>false,
		'readOnly'=>$readOnly,
		'htmlOptions' => array('class'=>'starsRating'),
		'cssFile'=>'/css/rating/jquery.rating.css',
	);
	$attributes = array(
		'Accuracy'		=>	'rating_accuracy',
		'Communication'	=>	'rating_communication',
		'Cleanliness'	=>	'rating_cleanliness',
		'Location'		=>	'rating_location',
		'Check In'		=>	'rating_check_in',	
		'Value'			=>	'rating_review'
	);
	$col = 0;
?>
<div id="rating_num">
	<div style="width:<?php echo $rating; ?>%;"><span></span></div>
</div>

<table class="rate_table">
		<tr>
	<?php foreach ($attributes as $key => $attribute) : ?>
		<?php if($col % 2 == 0) : ?>
		</tr><tr>
		<?php endif ?>
			<?php $col += 1; ?>
			<td><?php echo Yii::t("main", $key)?></td>
			<td>
				<div>
					<?php
						if($readOnly){
							$configStarRaiting['name'] = 'Review['.$attribute.']';
							$configStarRaiting['value'] = $model->GetFormattedRating($attribute);
						}
						else
						{
							$configStarRaiting['model'] = $review;
							$configStarRaiting['attribute'] = $attribute;
						}
						$this->widget('CStarRating', $configStarRaiting);
					?>
				</div>
			</td>
	<?php endforeach ?>
		</tr>
</table>